<script type="text/javascript">
function check_user_form()
{
	display('&nbsp;','alert_user_name');
	display('&nbsp;','alert_user_password');
	display('&nbsp;','alert_confirm_password');
	
	var frm_name=document.getElementById("frm_user_new");
	var aCheck = new Array(); 
 	aCheck.push ( new Array('admin_username', 1, 200, "{TEXT.input_user_name}", false, false, 'alert_user_name') );
	aCheck.push ( new Array('admin_password', 1, 200, "{TEXT.input_password}", false, false,'alert_user_password') );
	aCheck.push ( new Array('administrator_password_confirm', 1, 200, "{TEXT.input_password}", false, false,'alert_confirm_password' ) );
	var bRes = validateFields(aCheck);
	if(!bRes)
	{
		
	}
	else
	{			
		if(document.getElementById('admin_password').value!=document.getElementById('administrator_password_confirm').value)
		{
			display('{TEXT.not_match_password}','alert_confirm_password');
			return;
		}
		else
		{
			frm_name.submit();
		}
	}		
}
function changeRole(){
    var role = document.frmUpdate.admin_role.value;
    if(role != 3){
        document.getElementById('id_staff_show1').style.display = "none";
        document.getElementById('id_staff_show2').style.display = "none";
    }
    else{
        document.getElementById('id_staff_show1').style.display = "";
        document.getElementById('id_staff_show2').style.display = "";
    }
}
window.onload = function(){
    changeRole();
}
</script>

<form name="frmUpdate" id="frm_user_new" action="" method="post" enctype="multipart/form-data">
<input type="hidden" name="sAction" value="do_add_new" /> 
<table class="adminform" >
  <tr>
    <th colspan="2" scope="col">&nbsp;</th>
    </tr>
  <tr>
    <td width="150">{MANAGER.username}<span class="require">*1</span>:</td>
    <td>
		<input type="text" class="txtbox" name="admin_username" id="admin_username" value="{admin_username}" />
		<span id="alert_user_name" class="error">&nbsp;</span>
	</td>
  </tr>
  <tr>
    <td>{MANAGER.password}<span class="require">*</span>:</td>
    <td>
		<input type="password" name="admin_password" id="admin_password" class="txtbox" value="" />
		<span id="alert_user_password" class="error">&nbsp;</span>
	</td>
  </tr>
  <tr>
    <td>{MANAGER.password_confirm}<span class="require">*</span>:</td>
    <td>
		<input type="password" name="administrator_password_confirm" id="administrator_password_confirm" class="txtbox" value=""/>
		<span id="alert_confirm_password" class="error">&nbsp;</span>
	</td>
  </tr>
  <tr>
    <td>{MANAGER.fullname} :</td>
    <td><input type="text" name="admin_fullname" id="admin_fullname" value="{admin_fullname}" class="txtbox" /></td>
  </tr>
  <tr>
    <td>{MANAGER.email} :</td>
    <td><input type="text" name="admin_email" id="admin_email" value="{admin_email}" class="txtbox" /></td>
  </tr>
  
  <tr>
    <td>{MANAGER.phone} :</td>
    <td><input type="text" name="admin_phone" id="admin_phone" value="{admin_phone}" class="txtbox" /></td>
  </tr>
  <tr>
    <td>{MANAGER.status} :</td>
    <td><input type="checkbox" name="admin_status" checked /> {FORM.active}</td>
  </tr>
  <tr>
    <td>{MANAGER.role} :</td>
    <td><select name="admin_role" onchange="changeRole()">
    	<option value="1" {admin_role_1} >{MANAGER.supper_admin}</option>
		<option value="2" {admin_role_2} >{MANAGER.admin}</option>
		<option value="3" {admin_role_2} >{MANAGER.shop_owner}</option>
		</select>
	</td>
  </tr>
  <tr id="id_staff_show1">
    <td >{MANAGER.category_default} : </td>
    <td>
            <select id="category" name="category">
                <!-- BEGIN: root_category-->
                <option value="{category.product_category_id}" {category.select}>{category.product_category_name}</option>
                <!-- END: root_category-->
            </select>
    </td>
  </tr>
  <tr id="id_staff_show2">
    <td >{MANAGER.template_default} : </td>
    <td>
            <select id="template" name="template">
                <!-- BEGIN: template-->
                <option value="{template_default.id}" {template_default.select}>{template_default.name}</option>
                <!-- END: template-->
            </select>
    </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</form>